{include file="public/css"}
{include file="public/js"}
<form class="layui-form" action="" style="padding:20px;">
   {:token()}
      <div class="layui-form-item">
        <label class="layui-form-label">解冻金额</label>
        <div class="layui-input-inline" style="width:100px">
          <input type="text" name="amount" required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">保证金：</label>
        <div class="layui-input-inline">
            <div class="layui-form-mid layui-word-aux">{$user.deposit}</div>
        </div>
      </div>
  
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn layui-btn-normal" lay-submit lay-filter="form" >申请解冻</button>
        </div>
      </div>
    </form>

  {if $incomplete ==1}
  <div class="unfreeze-msg">您有未完成的交易订单，暂时无法解冻保证金!</div>
  {else}
{if !empty($last_success_time)}  <div class="unfreeze-msg">最后一笔订单完成时间 {$last_success_time|date="Y-m-d"}， {$settings['finance']['unfreeze_days']}天后才可以解冻 。</div>{/if}
  {/if}



 
<script>

layui.use(['form','layer'], function(){
  var form = layui.form;
   var layer = layui.layer;
  //监听提交
  form.on('submit(form)', function(data){
      $.post("{:url('@user/finance/unfreezeDeposit')}",data.field,function(json){
       if(json.code == 0){
    
          parent.parent.layer.msg(json.msg);
          var index = parent.layer.getFrameIndex(window.name);
          parent.layer.close(index); 
       }else{
           layer.msg(json.msg);
       }
     });
    return false;
  });
});
</script>